﻿using System;
using YAF.Classes.Core;

namespace YAF.Modules
{
    [YafModule("Init Services Module", "Tiny Gecko", 1)]
    public class InitServicesModule : IBaseModule
    {
        public YafContext PageContext
        {
            get
            {
                return YafContext.Current;
            }
        }

        #region IBaseModule Members
        public object ForumControlObj
        {
            get;
            set;
        }

        public void Init()
        {
            YafServices.StopWatch.Start();
            YafServices.InitializeDb.Run();
            YafServices.BannedIps.Run();

            YafContext.Current.PageUnload += Current_PageUnload;
        }

        public void Dispose()
        { 
        }
        #endregion

        private void Current_PageUnload(object sender, EventArgs e)
        {
            YafServices.StopWatch.Stop();
        }
    }
}
